<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>学生主页面</title>
    <link rel="stylesheet" type="text/css" href="../static/admin/layui2/css/layui.css"/>
    <style>
        a:hover{
            color: #00b7ee;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header" style="background-image: linear-gradient(120deg, #131313,#4c4c4c);">
        <div class="layui-logo"><a href="yuangong-main.html" style="color: #47b3ff;font-size: 25px;">学生主页</a></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item"><a class="layui-icon" href="guanliyuan-login.html">管理员登录</a></li>
            <li class="layui-nav-item"><a class="layui-icon layui-icon-logout" style="color: #ff3c00;font-size: 20px;text-align: center;" href="student-login.html">退出</a></li>
        </ul>
    </div>

    <div class="layui-side" style=" background-image: linear-gradient(120deg, #a7d3f2,#1E9FFF);">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-bg-black"  lay-filter="test">
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-user" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i> 信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="student-informationChange.html"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>基本信息修改</a></dd>
                        <dd><a href="student-mimaChange.html" class="layui-this layui-bg-blue"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>修改密码</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a class="" href="student-apply.html"><i class="layui-icon layui-icon-form" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>奖学金申请</a>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a class="" href="student-box.html"><i class="layui-icon layui-icon-notice" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>通知</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div class="layui-anim layui-anim-scale" style="margin-top: 50px;margin-left: 50px;">
            <form class="layui-form layui-form-pane">
                <div class="layui-form-item">
                    <label class="layui-form-label">原密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="password1" name="password1" lay-verify="required" autocomplete="off" placeholder="请输入原密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="password2" name="password2" lay-verify="required" placeholder="请输入新密码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">确认新密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="passsword3" lay-verify="required|confirmPass" placeholder="确认新密码密码" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux" id="ms"></div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn layui-bg-blue" lay-submit="" lay-filter="changeForm">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="layui-footer layui-bg-black">
    </div>
</div>
<script src="../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer'], function(){
        var element = layui.element;
        var form = layui.form;
        layer = layui.layer,
            $ =layui.jquery;

        form.verify({
            confirmPass:function(value,item){
                if($('input[name=password2]').val() !== value)
                    return '两次密码输入不同！';
            }
        });
        form.on('submit(changeForm)',function (data) {
            $.ajax({
                type:"POST",
                url:"/student/changeMima",
                data:{
                    "password1": data.field.password1,
                    "password2": data.field.password2,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag){
                        layer.msg('修改成功', {icon: 1});
                        $("#password1").val('');
                        $("#password2").val('');
                        $("#passsword3").val('');
                    }else {
                        layer.msg(res.msg, {icon: 5});
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>